package service.Impl;

import dao.FreelancerRepository;
import dao.Impl.FreelancerRepositoryImpl;
import entity.Freelancer;
import service.FreelancerService;

import java.util.ArrayList;

public class FreelancerServiceImpl implements FreelancerService {

    /**
     * 获取自由职业者信息表
     */
    @Override
    public ArrayList<Freelancer> getFreelancerList(){
        FreelancerRepository freelancerRepository = new FreelancerRepositoryImpl();
        return freelancerRepository.getFreelancerList();
    }

    /**
     * 添加自由职业者信息
     */
    @Override
    public boolean addFreelancer(Freelancer freelancer) {
        FreelancerRepository freelancerRepository = new FreelancerRepositoryImpl();
        return freelancerRepository.addFreelancer(freelancer);
    }

    /**
     * 根据自由职业者编号返回自由职业者信息
     */
    @Override
    public Freelancer findById(Integer freelancerId) {
        FreelancerRepository freelancerRepository = new FreelancerRepositoryImpl();
        return freelancerRepository.findById(freelancerId);
    }
    /**
     * 修改自由职业者信息
     */
    @Override
    public boolean updateFreelancer(Freelancer freelancer) {
        FreelancerRepository freelancerRepository = new FreelancerRepositoryImpl();
        return freelancerRepository.updateFreelancer(freelancer);
    }

    /**
     * 根据自由职业者编号删除自由职业者信息
     */
    @Override
    public boolean deleteFreelancer(Integer freelancerId) {
        FreelancerRepository freelancerRepository = new FreelancerRepositoryImpl();
        return freelancerRepository.deleteFreelancer(freelancerId);
    }

}
